#ifndef _PM_H_
#define _PM_H_

#include <stdio.h>
#include <stdlib.h>
#include <pnm.h>
#include <limits.h>

#ifndef MAX
#define MAX(a, b) ((a)>(b)?(a):(b))
#define MIN(a, b) ((a)<(b)?(a):(b))
#endif

#define IJ_TO_INT(x, y) (((y)<<12 )|(x))
#define INT_TO_J(v) ((v)&((1<<12)-1))
#define INT_TO_I(v) ((v)>>12)



int dist( pnm a, pnm b, int ax, int ay, int bx, int by, int cutoff );

void improve_guess( pnm a, pnm b, int ai, int aj, int *ibest, int *jbest, int *dbest, int bi, int bj);


#endif 